package org.chen.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.chen.domain.entity.AvatarConfigItem;

import java.util.List;

/**
 * 数字人配置项Mapper
 */
@Mapper
public interface AvatarConfigItemMapper extends BaseMapper<AvatarConfigItem> {
    /**
     * 批量插入数字人配置项
     * @param items 配置项列表
     * @return 插入数量
     */
    @Insert("<script>" +
            "INSERT INTO avatar_config_item (id, config_id, avatar_id, voice_id, x_offset, y_offset, scale, item_order, create_time, update_time) VALUES " +
            "<foreach collection='list' item='item' separator=','>" +
            "(#{item.id}, #{item.configId}, #{item.avatarId}, #{item.voiceId}, #{item.xOffset}, #{item.yOffset}, #{item.scale}, #{item.itemOrder}, #{item.createTime}, #{item.updateTime})" +
            "</foreach>" +
            "</script>")
    int batchInsert(@Param("list") List<AvatarConfigItem> items);
}